# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-typeprof
_gemname=typeprof
# Keep version in sync with "Bundled gems" (https://stdgems.org) for the
# packaged Ruby version.
pkgver=0.21.11
pkgrel=0
pkgdesc="A type analysis tool for Ruby code based on abstract interpretation"
url="https://github.com/ruby/typeprof"
arch="noarch"
license="MIT"
depends="ruby ruby-rbs"
checkdepends="ruby-bundler ruby-rake ruby-test-unit"
makedepends="ruby-rdoc"
subpackages="$pkgname-doc"
source="https://github.com/ruby/typeprof/archive/v$pkgver/$_gemname-$pkgver.tar.gz
	gemspec.patch
	"
builddir="$srcdir/$_gemname-$pkgver"
options="!check"  # FIXME

build() {
	gem build $_gemname.gemspec
}

check() {
	rake test
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	gem install \
		--local \
		--install-dir "$gemdir" \
		--bindir "$pkgdir/usr/bin" \
		--ignore-dependencies \
		--document ri \
		--verbose \
		$_gemname

	# Remove unnessecary files
	cd "$gemdir"
	rm -rf build_info cache extensions plugins
}

doc() {
	pkgdesc="$pkgdesc (ri docs)"

	amove "$(ruby -e 'puts Gem.default_dir')"/doc
}

sha512sums="
3ef58d5cee24f037a32984a7f9757958f0276732918a58c27aed15b11e43d57da92d4fcf41eeb017d7fe8cacfd801f0fc9cdcf03cfc2e663f8660097cde8fb61  typeprof-0.21.11.tar.gz
38b5f848ecf7c60c8c82bd57fabb4a1113789c31602058cc32de4d2c186acb5ec8f6d966b7ec09ccbc080640b5137477b49b5918015fd4859b1b91a7069869e2  gemspec.patch
"
